package com.fyzk.activity.zhifu;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;

import com.fyzk.activity.myview.BeiShuEditText;
import com.fyzk.activity.myview.BeiShuEditText.ET_action;
import com.tyjc.lottery.R;

/**
 * 传统足彩支付
 */
public abstract class OldFootballPayActivity extends JCBasePayActivity implements
		ET_action {

	private LinearLayout ziXuan;
	private LinearLayout jiXuan;

	protected ListView listView;

	// ======================= 新加 ==========================================
	private BeiShuEditText et_bei;

	/** 追期、投倍 增减号 */
	private ImageView bei_left, bei_right;
	// ======================= 新加 ==========================================

	@Override
	public View initCenterView() {
		// TODO Auto-generated method stub
		View view = LayoutInflater.from(this).inflate(R.layout.zc_zhifu, null);

		ziXuan = (LinearLayout) view.findViewById(R.id.zc_zhifu_center_zixuan);
		jiXuan = (LinearLayout) view.findViewById(R.id.zc_zhifu_center_jixuan);

		listView = (ListView) view.findViewById(R.id.zc_zhifu_listview);
		addAdapter();

		et_bei = (BeiShuEditText) view.findViewById(R.id.zc_zhifu_et_tou);
		bei_left = (ImageView) view.findViewById(R.id.zc_zhifu_iv_tou_l);
		bei_right = (ImageView) view.findViewById(R.id.zc_zhifu_iv_tou_r);

		et_bei.setEt(this);
		// 事件
		ziXuan.setOnClickListener(new OnClick());
		jiXuan.setOnClickListener(new OnClick());
		jiXuan.setVisibility(View.INVISIBLE);

		bei_left.setOnClickListener(new OnClick());
		bei_right.setOnClickListener(new OnClick());

		return view;
	}

	//
	// @Override
	// protected View initCenterView(){

	// }
	
	protected abstract int getMaxGuoGuan();

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}

	@Override
	protected void clear() {
		initGuoGuanView();
	}

	@Override
	public void initGuoGuanView() {
		// TODO Auto-generated method stub
		super.initGuoGuanView();
	}

	class OnClick implements OnClickListener {
		@Override
		public void onClick(View v) {
			switch (v.getId()) {
			case R.id.zc_zhifu_center_zixuan:
				onClick1();
				break;
			case R.id.zc_zhifu_center_jixuan:
//				onClick1();
				break;
			case R.id.zc_zhifu_iv_tou_l:

				et_bei.setText(et_bei.zhui_tou(1, 0));

				break;
			case R.id.zc_zhifu_iv_tou_r:

				et_bei.setText(et_bei.zhui_tou(1, 1));

				break;
			default:
				break;
			}

		}

	}

	protected abstract void addAdapter();

	protected abstract void onClick1();

	@Override
	public void action() {
		// TODO Auto-generated method stub
		Log.e("action", "edittext  change....");
		setBtmView();
	}
	@Override
	public int getBeishu() {
		// TODO Auto-generated method stub
		return Integer.parseInt(et_bei.getText().toString());
	}
	
	@Override
	public int getOneAmount() {
		// TODO Auto-generated method stub
		return 2;
	}
	

}
